﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BangleCMS.Model;
using BangleCMS.BLL;

public partial class index : WebPageBase
{
    #region 属性
    private DataTable _dt_indeximg;
    public DataTable DT_IndexImg
    {
        get
        {
            if(_dt_indeximg==null)
            {
                _dt_indeximg = new DataTable();
            }
            return _dt_indeximg;
        }
        set
        {
            _dt_indeximg = value;
        }
    }

    private DataTable _dt_newslist;
    public DataTable DT_Newslist
    {
        get
        {
            if (_dt_indeximg == null)
            {
                _dt_newslist = new DataTable();
            }
            return _dt_newslist;
        }
        set
        {
            _dt_newslist = value;
        }
    }
    #endregion


    #region 共用方法
    public string GetNewsDetailUrl(string code, int id)
    {
        return string.Format("/news/{0}/{1}.shtml", code, id);
    }
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        BindDate();
    }

    private void BindDate()
    {
        try
        {
            DT_IndexImg = new UtilityBLL().GetListByPage("t_indeximg", "*", "Valid=1", "OrderNo", 0, 1, 50).Tables[0];
        }
        catch (Exception ex)
        {
        }

        try
        {
            DT_Newslist = new UtilityBLL().GetListByPage("view_t_news", "*", "Valid=1", "CreateDate", 0, 1, 10).Tables[0];
        }
        catch (Exception ex)
        {

        }
    }
}
